#include<bits/stdc++.h>

using namespace std;
int strength[100005]={};
bool temp[100005]={};
bool activity[100005]={};
int main()
{
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    int n,i,ans,temp1,temp2,is,j;
    bool flag1=true,flag2=true;
    cin>>n;
    ans=n;
    for(i=1;i<=n;i++)
    {
        cin>>strength[i];
    }
    if(n==1)
    {
        cout<<1;
        return 0;
    }
    else
    {
        is=1;
        for(i=2;i<=n;i++)
        {
            temp2=strength[i];
            for(j=is;j<=i;j++)
            {
                if(temp[j]==0&&temp2>strength[j]&&activity[i]==0)
                {
                    temp[j]=1;
                    activity[i]=1;
                    ans--;
                }
                else if(temp[j]==0&&temp2<strength[j]&&activity[j]==0)
                {
                    temp[i]=1;
                    activity[j]=1;
                    ans--;
                }
                else
                {
                    continue;
                }
            }
        }
    }
    cout<<ans;

    return 0;
}
